package com.lwj.hiring.talent.dao;

import java.util.List;

import com.lwj.hiring.common.util.DBUtil;
import com.lwj.hiring.talent.entity.ResumeEntity;

/**
 * resume Dao
 * 
 * @author Administrator
 *
 */
public class ResumeDao {

	/**
	 * 简历列表
	 * 
	 * @param id
	 * @return
	 */
	public List<ResumeEntity> list(int id) {
		String sql = "SELECT * FROM resume WHERE talent_id=?";
		return DBUtil.executeQuery(ResumeEntity.class, sql, id);
	}

	/**
	 * 删除简历
	 * 
	 * @param id
	 * @return
	 */
	public int delete(int id) {
		String sql = "DELETE FROM resume WHERE id=?";
		return DBUtil.executeUpdate(sql, id);
	}

	/**
	 * 新增简历
	 * 
	 * @param list
	 * @return
	 */
	public int add(List<Object> list) {
		String sql = "INSERT INTO resume VALUES(null,?,?,?,?)";
		return DBUtil.executeUpdate(sql, list);
	}

	/**
	 * 根据Id查询简历
	 * 
	 * @param id
	 * @return
	 */
	public ResumeEntity queryById(int id) {
		String sql = "SELECT * FROM resume WHERE id=?";
		return DBUtil.getUniqueResult(ResumeEntity.class, sql, id);
	}

	/**
	 * 修改简历
	 * 
	 * @param list
	 * @return
	 */
	public int update(List<Object> list) {
		String sql = "UPDATE resume SET intention=?,work_experience=?,project_experience=? WHERE id=?";
		return DBUtil.executeUpdate(sql, list);
	}

}
